package top.lixb.libcommon.utils;

import com.vondear.rxtool.RxActivityTool;
import com.vondear.rxtool.RxAppTool;
import com.vondear.rxtool.view.RxToast;

public class APPUtils {
    public static boolean exitApplication() {
        if (firstBackKeyDown == 0) {
            firstBackKeyDown = System.currentTimeMillis();
            RxToast.showToast("再按一次退出应用");
            return true;
        } else {
            if (System.currentTimeMillis() - firstBackKeyDown <= 2000) {
                RxActivityTool.finishAllActivity();
//                Process.killProcess(Process.myPid());
                return true;
            } else {
                firstBackKeyDown = 0;
                exitApplication();
                return true;
            }
        }
    }
    private static long firstBackKeyDown;
}
